//
//  BaseNavigationController.m
//  CoreGraphicsDemo
//
//  Created by iSolar on 2017/9/14.
//  Copyright © 2017年 nothing. All rights reserved.
//

#import "BaseNavigationController.h"

@interface BaseNavigationController ()

@end

@implementation BaseNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationBar.barTintColor = [UIColor colorWithHexString:@"2f2f34"];
    self.navigationBar.translucent = NO;
    NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,
                                [UIFont fontWithName:@"TimesNewRomanPSMT" size:18], NSFontAttributeName, nil];
    [[UINavigationBar appearance] setTitleTextAttributes:attributes];
    
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithTitle:@""
                                                                style:UIBarButtonItemStylePlain
                                                               target:nil
                                                               action:nil];
    self.navigationBar.tintColor =
    [UIColor whiteColor];
    //主要是以下两个图片设置
    self.navigationBar.backIndicatorImage = [UIImage imageNamed:@"back"];
    self.navigationBar.backIndicatorTransitionMaskImage = [UIImage imageNamed:@"back"];
    self.navigationItem.backBarButtonItem = backItem;
    
    //移除底部黑线
    [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
    
    // 添加自定义线
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, self.navigationBar.frame.size.height - 0.5, self.navigationBar.frame.size.width, 0.5)];
    line.backgroundColor = [UIColor colorWithHexString:@"d5d5d5"];
    [self.navigationBar addSubview:line];
    [self.navigationBar bringSubviewToFront:line];

}

- (void)back {
    [self.navigationController popViewControllerAnimated:YES];
}

@end
